import{EditdiscussParams} from"../../types/parmas"
import { postSelectDiscuss,postAddDiscuss} from "../../api/userinfo"
const discuss = {
  state: {
    discussInfo:{}
  },

  mutations: {
    //保存订单基本信息
    SET_DISCUSSINFO(state: any, value: any) {
      state.discussInfo = value;
    },
  },

  actions: {
    async SET_DISCUSSINFO(content: any, mid:any) {
    return new Promise(async (resolve, reject)=>{
    await postSelectDiscuss({mid:mid}).then((res)=>{
        content.commit("SET_DISCUSSINFO",res.data)
       })
    })
    },
    async SET_ADDDISCUSS(content: any, discuss:EditdiscussParams) {
      return new Promise(async (resolve, reject)=>{
      await postAddDiscuss(discuss).then((res)=>{
          // content.commit("SET_DISCUSSINFO",res.data)
          console.log(res.data);
         })
      })
      },
}
}
export default discuss;